{% extends 'admin/base_site.html' %}
{% load i18n admin_urls static admin_list %}


{% block extrastyle %}
  {{ block.super }}
  <link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" />
  {% if cl.formset %}
    <link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />
  {% endif %}
  {% if cl.formset or action_form %}
    <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
  {% endif %}
  {{ media.css }}
  {% if not actions_on_top and not actions_on_bottom %}
    <style>
      #changelist table thead th:first-child {width: inherit}
    </style>
  {% endif %}
{% endblock %}


{% block extrahead %}
{{ block.super }}
{{ media.js }}
{% endblock %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-list{% endblock %}


{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; <a href="/admin/metadata/hivetableinfo/">元数据管理</a>
&rsaquo; 表字段编辑
</div>
{% endblock %}
{% endif %}

{% block coltype %}flex{% endblock %}

{% block content %}
  <div id="content-main">
      <div class="row">
          <strong>数据库名</strong>：{{ table_info.db_name }} &nbsp;&nbsp;&nbsp;
          <strong>表名</strong>：{{ table_info.table_name }} {{ table_info }}
      </div>
    <form action="/column/column_edit/" method="post">

      <div class="results" id="changelist">
          <input type="hidden" name="tbl_id" value="{{ tbl_id }}"
        {% csrf_token %}
        <table id="result_list">
          <thead>
          <tr>
              <th scope="col"><span>id</span></th>
              <th scope="col"><span>字段名称</span></th>
              <th scope="col"><span>类型</span></th>
              <th scope="col"><span>原始描述</span></th>
              <th scope="col"><span>修改描述</span></th>
          </tr>
          </thead>
          <tbody>
          {% for result in results %}
            <tr>
              <td class="field">{{ result.column_idx }}</td>
              <td class="field">{{ result.column_name }}</td>
              <td class="field">{{ result.column_type }}</td>
              <td class="field">{{ result.column_desc }}</td>
              <input type="hidden" name="idArr[]"  value="{{ result.id }}" />
              <td class="field"><input type="text" size="60" name="columnArr[]" value="{{ result.column_desc_maintain }}" ></td>

            </tr>
          {% endfor %}

          </tbody>
        </table>


        <div class="submit-row">
<!--            <a href="/admin/metadata/hivetableinfo/">返回元数据管理列表</a>-->
          <input type="button" value="返回" id="column_history" onclick="return_metadata()" />

          <input type="submit" value="保存" name="save" />
        </div>
      </div>

    </form>

  </div>
<script>
function return_metadata(){
    window.location.href="/admin/metadata/hivetableinfo/"
}
</script>
{% endblock %}




